const addon = require('./build/Release/template.node');

console.log('=== Testing Node-API Toolkit ===');

console.time("Create Calculator");
const calc = new addon.Calculator();
console.timeEnd("Create Calculator");

console.log('Calculator Object:');
console.log('PI:', calc.PI);
console.log('Name:', calc.name);
console.log('Value:', calc.value);

console.log('Calculator Methods:');
console.time("add");
console.log('1 + 2 =', calc.add(1, 2));
console.timeEnd("add");

console.log('5 - 3 =', calc.subtract(5, 3));
console.log('3 * 4 =', calc.multiply(3, 4));
console.log('10 / 2 =', calc.divide(10, 2));

console.log('Direct Function Calls:');
console.log('add(10, 20) =', addon.add(10, 20));
console.log('multiply(6, 7) =', addon.multiply(6, 7));

console.log('Module Constants:');
console.log('Version:', addon.VERSION);
console.log('Author:', addon.AUTHOR);

console.log('Error Handling:');
try {
    console.log('10 / 0 =', calc.divide(10, 0));
} catch (err) {
    console.log('Caught error:', err.message);
}

console.log('=== Test Complete ===');